home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
050
/
madtrb1.arc
/
DISPLAY.INC
next >
Wrap
Text File
|
1986-02-27
|
21KB
|
506 lines
{ DISPLAY.INC }
{ *************************************************************************** }
{ * * }
{ * TURBO SCREEN INPUT PRE-PROCESSOR TOOLKIT * }
{ * * }
{ * DISPLAY SCROLLING INPUT SUBPROGRAM INCLUDE FILE * }
{ * * }
{ * Version 1.07 * }
{ * * }
{ * * }
{ * This include file provides a visual representation of the scrolling * }
{ * input data as the user enters it. Note that this include file is * }
{ * specific to the example application of the input pre-processor, * }
{ * although you may want to write a similar routine that perhaps * }
{ * displays a graph, bar chart, etc. representing the user entered input * }
{ * data. * }
{ * * }
{ *************************************************************************** }
Const
TOP_EDGE_OF_DISPLAY_WINDOW=2; { top physical screen row of the display window }
BOTTOM_EDGE_OF_DISPLAY_WINDOW=9; { bottom physical screen row of the display window }
LEFT_EDGE_OF_DISPLAY_WINDOW=3; { left physical screen column of the display window }
RIGHT_EDGE_OF_DISPLAY_WINDOW=78; { right physical screen column of the display window }
Procedure DrawSimpleBeam;
{ This procedure is specific to the example application of the input
pre-processor. This procedure draws a representation of a beam onto the
scrolling input pages. }
Var
ScreenCol:Integer; { a screen column index counter }
Begin { DrawSimpleBeam }
Window(LEFT_EDGE_OF_DISPLAY_WINDOW, { define a portion of the screen as the active window }
TOP_EDGE_OF_DISPLAY_WINDOW,
RIGHT_EDGE_OF_DISPLAY_WINDOW,
BOTTOM_EDGE_OF_DISPLAY_WINDOW);
TextColor(ForegroundColor);
TextBackground(BackgroundColor);
GotoXY(17,4); { draw beam }
For ScreenCol:=1 To 40 Do
Write(Chr(22));
GotoXY(17,5); { draw left beam support }
Write(Chr(94));
GotoXY(56,5); { draw right beam support }
Write(Chr(94));
GotoXY(58,6);
Write('LOAD');
GotoXY(58,7);
Write('TYPE:');
If (S_I_Page=1) Or (S_I_Page=3) Then
Begin
GotoXY(58,8);
Write('WIDTH:');
End; { If Page }
GotoXY(17,6); { draw dimension line }
Write(Chr(179));
GotoXY(56,6);
Write(Chr(179));
GotoXY(17,7);
Write(Chr(179));
GotoXY(56,7);
Write(Chr(179));
GotoXY(17,8);
Write(Chr(195));
GotoXY(56,8);
Write(Chr(180));
GotoXY(18,8);
For ScreenCol:=1 To 38 Do
Write(Chr(196));
End; { DrawSimpleBeam }
Procedure DisplayBeamLength;
{ This procedure is specific to the example application of the input
pre-processor. This procedure displays the inputed beam length under the
displayed beam. }
Begin { DisplayBeamLength }
Window(LEFT_EDGE_OF_DISPLAY_WINDOW, { define a portion of the screen as the active window }
TOP_EDGE_OF_DISPLAY_WINDOW,
RIGHT_EDGE_OF_DISPLAY_WINDOW,
BOTTOM_EDGE_OF_DISPLAY_WINDOW);
TextColor(ForegroundColor);
TextBackground(BackgroundColor);
GotoXY(34-((Length(G_I_Data[13,1]^)) Div 2),8);
Write(' ',G_I_Data[13,1]^,' ft. ');
End; { DisplayBeamLength }
Procedure DisplayBeamLoadModule;{( CurrentInputCol,
CurrentInputRow:Integer);}
{ *************************************************************************** }
{ * * }
{ * BEAM LOADING DISPLAY MODULE * }
{ * * }
{ * This module takes care of the display of individual beam loadings. * }
{ * It first removes the previous loading from the model beam and then * }
{ * displays the current beam loading under investigation. * }
{ * * }
{ * Note that this module is specific to the example application of the * }
{ * input pre-processor. * }
{ * * }
{ *************************************************************************** }
Var { Modular Variables, i.e. global only to this module }
X_Entry:Integer; { variable used to store converted string load data entries }
X1_Entry:Integer; { variable used to store converted string load data entries }
X2_Entry:Integer; { variable used to store converted string load data entries }
X_Position:Integer; { variable indicate screen positions for showing limits of applied load }
X1_Position:Integer; { variable indicate screen positions for showing limits of applied load }
X2_Position:Integer; { variable indicate screen positions for showing limits of applied load }
Procedure InitBeamLoadDisplay;
{ This procedure initializes the beam loading module. It determines values
for beam length and load dimension lines. }
Var
ErrorCode:Integer; { variable used in the return of an error code during string conversion to integer }
Begin { InitBeamLoadDisplay }
{ Convert string data into data of type real }
Val(G_I_Data[13,1]^,BeamLength,ErrorCode);
Val(S_I_Data[2,CurrentInputRow,S_I_Page]^,X_Entry,ErrorCode);
X1_Entry:=X_Entry;
Val(S_I_Data[4,CurrentInputRow,S_I_Page]^,X2_Entry,ErrorCode);
{ Define screen position variables }
X_Position:=Trunc(X_Entry*39/BeamLength);
X1_Position:=X_Position;
X2_Position:=Trunc(X2_Entry*39/BeamLength);
End; { InitBeamLoadDisplay }
Procedure RemoveBeamLoading;
{ This procedure removes the graphical loading on the displayed beam. }
Begin { RemoveBeamLoading }
TextColor(ForegroundColor);
TextBackground(BackgroundColor);
Window(3,2,76,4); { remove beam loading }
ClrScr;
Window(20,6,57,8); { remove dimension strings }
ClrScr;
Window(3,7,18,8); { remove X1 (or X) and X2 identifier }
ClrScr;
Window(66,8,78,9); { remove load type and width identifiers }
ClrScr;
Window(LEFT_EDGE_OF_DISPLAY_WINDOW, { define a portion of the screen as the active window }
TOP_EDGE_OF_DISPLAY_WINDOW,
RIGHT_EDGE_OF_DISPLAY_WINDOW,
BOTTOM_EDGE_OF_DISPLAY_WINDOW);
GotoXY(17,6); { remove ends of dimension strings from beam length leaders }
Write(Chr(179));
GotoXY(56,6);
Write(Chr(179));
GotoXY(17,7);
Write(Chr(179));
GotoXY(56,7);
Write(Chr(179));
End; { RemoveBeamLoading }
Procedure ShowUniformLoading;
{ This procedure shows the uniform load acting upon the beam. }
Var
ScreenCol:Integer; { a screen column index counter }
Begin { ShowUniformLoading }
If(S_I_Data[2,CurrentInputRow,S_I_Page]^<>'') And (S_I_Data[4,CurrentInputRow,S_I_Page]^<>'') Then
Begin { enough data to display loading }
GotoXY(X1_Position+17,3); { show uniform load above beam }
For ScreenCol:=X1_Position To X2_Position Do
Write(Chr(219));
If S_I_Data[3,CurrentInputRow,S_I_Page]^<>'' Then
Begin
GotoXY(((X1_Position+X2_Position) Div 2)+17-(Length(S_I_Data[3,CurrentInputRow,S_I_Page]^)+4) Div 2,2);
TextColor(HighlightColor);
Write(S_I_Data[3,CurrentInputRow,S_I_Page]^,' psf');
TextColor(ForegroundColor);
End; { If S_I_Data }
End; { If S_I_Data }
End; { ShowUniformLoading }
Procedure ShowPointLoading;
{ This procedure shows the point load acting upon the beam. }
Begin { ShowPointLoading }
If(S_I_Data[2,CurrentInputRow,S_I_Page]^<>'') And (S_I_Data[3,CurrentInputRow,S_I_Page]^<>'') Then
Begin { enough data to display loading }
If Copy(S_I_Data[3,CurrentInputRow,S_I_Page]^,1,1)='-' Then
Begin { show upward acting point load (negative load) above beam }
GotoXY(X_Position+17,3);
Write(Chr(24));
GotoXY(X_Position+17-(Length(S_I_Data[3,CurrentInputRow,S_I_Page]^)-1+5) Div 2,2);
TextColor(HighlightColor);
Write(Copy(S_I_Data[3,CurrentInputRow,S_I_Page]^,2,Length(S_I_Data[3,CurrentInputRow,S_I_Page]^)-1));
Write(' kips');
TextColor(ForegroundColor);
End { If Copy(S_I_Data }
Else
Begin { show downward acting point load (positive load) above beam }
GotoXY(X_Position+17,3);
Write(Chr(25));
GotoXY(X_Position+17-(Length(S_I_Data[3,CurrentInputRow,S_I_Page]^)+5) Div 2,2);
TextColor(HighlightColor);
Write(S_I_Data[3,CurrentInputRow,S_I_Page]^,' kips');
TextColor(ForegroundColor);
End; { Else }
End; { If S_I_Data }
End; { ShowPointLoading }
Procedure ShowPrismaticLoading;
{ This procedure shows the prismatic load acting upon the beam. }
Var
X1_LoadEntry:Real; { variable used to store converted string load data }
X2_LoadEntry:Real; { variable used to store converted string load data }
ErrorCode:Integer; { variable used in the return of an error code during string conversion to integer }
ScreenCol:Integer; { a screen column index counter }
Begin { ShowPrismaticLoading }
If(S_I_Data[2,CurrentInputRow,S_I_Page]^<>'') And (S_I_Data[4,CurrentInputRow,S_I_Page]^<>'') And
(S_I_Data[3,CurrentInputRow,S_I_Page]^<>'') And (S_I_Data[5,CurrentInputRow,S_I_Page]^<>'') Then
Begin { enough data to display loading }
GotoXY(X1_Position+17,3);
For ScreenCol:=X1_Position To X2_Position Do
Write(Chr(220));
Val(S_I_Data[3,CurrentInputRow,S_I_Page]^,X1_LoadEntry,ErrorCode);
Val(S_I_Data[5,CurrentInputRow,S_I_Page]^,X2_LoadEntry,ErrorCode);
If (X1_LoadEntry)<(X2_LoadEntry) Then
Begin { prismatic load slopes to the left }
For ScreenCol:=Trunc(((X1_Position)*0.75)+((X2_Position)/4)) To X2_Position Do
Begin
GotoXY(ScreenCol+17,3);
Write(Chr(219));
End; { For ScreenCol }
For ScreenCol:=(X1_Position+X2_Position) Div 2 To X2_Position Do
Begin
GotoXY(ScreenCol+17,2);
Write(Chr(220));
End; { For ScreenCol }
For ScreenCol:=Trunc(((X1_Position)/4)+((X2_Position)/1.333)) To X2_Position Do
Begin
GotoXY(ScreenCol+17,2);
Write(Chr(219));
End; { For ScreenCol }
TextColor(HighlightColor);
GotoXY(X1_Position-Length(S_I_Data[3,CurrentInputRow,S_I_Page]^)-3+17,2);
Write(S_I_Data[3,CurrentInputRow,S_I_Page]^,' psf');
GotoXY(X2_Position+17,1);
Write(S_I_Data[5,CurrentInputRow,S_I_Page]^,' psf');
TextColor(ForegroundColor);
End { If X1_LoadEntry }
Else
Begin { prismatic load slopes to the right }
For ScreenCol:=X1_Position To Trunc(((X1_Position)/4)+((X2_Position)/1.333)) Do
Begin
GotoXY(ScreenCol+17,3);
Write(Chr(219));
End; { For ScreenCol }
For ScreenCol:=X1_Position To (X1_Position+X2_Position) Div 2 Do
Begin
GotoXY(ScreenCol+17,2);
Write(Chr(220));
End; { For ScreenCol }
For ScreenCol:=X1_Position To Trunc(((X1_Position)/1.333)+((X2_Position)/4)) Do
Begin
GotoXY(ScreenCol+17,2);
Write(Chr(219));
End; { For ScreenCol }
TextColor(HighlightColor);
GotoXY(X1_Position-Length(S_I_Data[3,CurrentInputRow,S_I_Page]^)-3+17,1);
Write(S_I_Data[3,CurrentInputRow,S_I_Page]^,' psf');
GotoXY(X2_Position+17,2);
Write(S_I_Data[5,CurrentInputRow,S_I_Page]^,' psf');
TextColor(ForegroundColor)
End; { Else }
End; { If S_I_Data }
End; { ShowPrismaticLoading }
Procedure ShowAppliedMoment;
{ This Procedure shows the applied moment acting upon the beam. }
Begin { ShowAppliedMoment }
If (S_I_Data[2,CurrentInputRow,S_I_Page]^<>'') And (S_I_Data[3,CurrentInputRow,S_I_Page]^<>'') Then
Begin { enough data to display loading }
If Copy(S_I_Data[3,CurrentInputRow,S_I_Page]^,1,1)='-' Then
Begin { draw negative couple (counterclockwise couple) }
GotoXY(X_Position-1+17,2);
Write(Chr(17),Chr(191));
GotoXY(X_Position+17,3);
Write(Chr(192),Chr(16));
TextColor(HighlightColor);
GotoXY(X_Position+17+2,2);
Write(Copy(S_I_Data[3,CurrentInputRow,S_I_Page]^,2,Length(S_I_Data[3,CurrentInputRow,S_I_Page]^)-1));
Write(' ft-kips');
TextColor(ForegroundColor);
End { If Copy(S_I_Data }
Else
Begin { draw positive couple (clockwise couple) }
GotoXY(X_Position+17,2);
Write(Chr(218),Chr(16));
GotoXY(X_Position-1+17,3);
Write(Chr(17),Chr(217));
GotoXY(X_Position+17+2,2);
TextColor(HighlightColor);
Write(S_I_Data[3,CurrentInputRow,S_I_Page]^,' ft-kips');
TextColor(ForegroundColor);
End; { Else }
End; { If S_I_Data }
End; { ShowAppliedMoment }
Procedure Show_X_DimensionLine;
{ This procedure shows the X dimension line to indicate the point of load
application. }
Var
ScreenCol:Integer; { a screen column index counter }
Begin { Show_X_DimensionLine }
If S_I_Data[2,CurrentInputRow,S_I_Page]^<>'' Then
Begin
If X_Position<>0 Then
Begin
GotoXY(17,6);
Write(Chr(195));
For ScreenCol:=18 To X_Position+17-1 Do
Write(Chr(196));
Write(Chr(180));
If X_Position+17<>56 Then
Begin
GotoXY(X_Position+17,5);
Write(Chr(179));
End; { If X_Position+17 }
End; { If X_Position }
GotoXY(16-7-Length(S_I_Data[2,CurrentInputRow,S_I_Page]^),6);
TextColor(HighlightColor);
Write('X= ',S_I_Data[2,CurrentInputRow,S_I_Page]^,' ft.');
TextColor(ForegroundColor);
End; { If S_I_Data }
End; { Show_X_DimensionLine }
Procedure Show_X1_X2_DimensionLine;
{ This procedure shows the X1 & X2 dimension lines to indicate the limits of
the load application. }
Var
MaxLength:Integer; { variable used to store the length of the larger of the two strings; X1 and X2 }
ScreenCol:Integer; { a screen column index counter }
Begin { Show_X1_X2_DimensionLine }
If Length(S_I_Data[2,CurrentInputRow,S_I_Page]^)>Length(S_I_Data[4,CurrentInputRow,S_I_Page]^) Then
MaxLength:=Length(S_I_Data[2,CurrentInputRow,S_I_Page]^)
Else
MaxLength:=Length(S_I_Data[4,CurrentInputRow,S_I_Page]^);
If S_I_Data[2,CurrentInputRow,S_I_Page]^<>'' Then { Show X1 dimension }
Begin
If X1_Position<>0 Then
Begin
GotoXY(17,6);
Write(Chr(195));
For ScreenCol:=18 To X1_Position+17-1 Do
Write(Chr(196));
Write(Chr(180));
If X1_Position+17<>56 Then
Begin
GotoXY(X1_Position+17,5);
Write(Chr(179));
End; { If X1_Position+17 }
End; { If X1_Position }
GotoXY(16-8-MaxLength,6);
TextColor(HighlightColor);
Write('X1= ',S_I_Data[2,CurrentInputRow,S_I_Page]^,' ft.');
TextColor(ForegroundColor);
End; { If S_I_Data }
If S_I_Data[4,CurrentInputRow,S_I_Page]^<>'' Then { Show X2 dimension }
Begin
If X2_Position<>0 Then
Begin
GotoXY(17,7);
Write(Chr(195));
For ScreenCol:=18 To X2_Position+17-1 Do
Write(Chr(196));
Write(Chr(180));
If (X2_Position+17<>56) And (X2_Position<>X1_Position) Then
Begin
GotoXY(X2_Position+17,5);
Write(Chr(179));
GotoXY(X2_Position+17,6);
Write(Chr(179));
End; { If X2_Position+17 }
End; { If X2_Position }
GotoXY(16-8-MaxLength,7);
TextColor(HighlightColor);
Write('X2= ',S_I_Data[4,CurrentInputRow,S_I_Page]^,' ft.');
TextColor(ForegroundColor);
End; { If S_I_Data }
End; { Show_X1_X2_DimensionLine }
Procedure ShowLoadTypeIdentifier;
{ This procedure identifies the load type currently acting upon the beam. }
Begin { ShowLoadTypeIdentifier }
GotoXY(65,7);
TextColor(HighlightColor);
If S_I_Data[1,CurrentInputRow,S_I_Page]^<>'' Then
Write(S_I_Data[1,CurrentInputRow,S_I_Page]^);
TextColor(ForegroundColor);
End; { ShowLoadTypeIdentifier }
Procedure ShowLoadWidthIdentifier;
{ This procedure identifies the load width currently acting upon the beam. }
Begin { ShowLoadWidthIdentifier }
GotoXY(65,8);
TextColor(HighlightColor);
Case S_I_Page Of
1 : If S_I_Data[5,CurrentInputRow,S_I_Page]^<>'' Then
Write(S_I_Data[5,CurrentInputRow,S_I_Page]^,' ft.');
3 : If S_I_Data[6,CurrentInputRow,S_I_Page]^<>'' Then
Write(S_I_Data[6,CurrentInputRow,S_I_Page]^,' ft.');
End; { Case S_I_Page }
TextColor(ForegroundColor);
End; { ShowLoadWidthIdentifier }
Procedure ShowBeamLoading;
{ This procedure controls the specific screen procedures that are called
for specific load types. }
Begin { ShowBeamLoading }
Case S_I_Page Of
1 : Begin { uniform load type }
ShowUniformLoading;
Show_X1_X2_DimensionLine;
ShowLoadWidthIdentifier;
End; { uniform load type }
2 : Begin { point load type }
ShowPointLoading;
Show_X_DimensionLine;
End; { point load type }
3 : Begin { prismatic load type }
ShowPrismaticLoading;
Show_X1_X2_DimensionLine;
ShowLoadWidthIdentifier;
End; { prismatic load type }
4 : Begin { applied moment type }
ShowAppliedMoment;
Show_X_DimensionLine;
End; { applied moment type }
End; { Case S_I_Page }
ShowLoadTypeIdentifier;
Window(1,1,80,25); { reset active window }
End; { ShowBeamLoading }
Begin { DisplayBeamLoadModule }
InitBeamLoadDisplay; { initialize DisplayBeamLoadModule }
RemoveBeamLoading; { remove previous beam loading }
ShowBeamLoading; { display present beam loading }
End; { DisplayBeamLoadModule }